<?php
//邮件订阅页面
include("common.inc.php");
InitGP(array("action","email","cityid")); //初始化变量全局返回
if (!empty($email)) {
	//ajax请求
	if ($action=="ajax") {
		AjaxHead();
		include(INC_PATH."/mail.class.php");
		$mail=new MailClass();
		$info=$mail->add($email,$_USERS['uid'],$_cityid);
		
		if ($info=="OK") {
			$retunstr="邮件已经订阅!";
			
		}else {
			$retunstr=$info;
		}
		echo iconv(CHARSET, 'UTF-8',$retunstr);  
	}else {
		
		include(INC_PATH."/mail.class.php");
		$mail=new MailClass();
		$info=$mail->add($email,$_USERS['uid'],$cityid);
		if ($info=="OK") {
			showmessage("邮件订阅成功!","index.php",1);
			//dheader("index.php");
		}else {
			showmessage($info,"index.php",0);
		}
		
	}
	
}else {
	
	include template('mail');//包含输出指定模板
	
}

?>